#include <stdio.h>
#include <curl/curl.h>
int main(){
	CURL * mycurl;
	CURLcode res;
	mycurl=curl_easy_init();
	if (!mycurl){
		perror("error in curl");
		return 1;
	}
	FILE * tf = fopen("header.txt","w");
	FILE * bf = fopen("body.txt","w");
		
	curl_easy_setopt(mycurl,CURLOPT_URL,"http://www.baidu.com");
	curl_easy_setopt(mycurl,CURLOPT_WRITEHEADER,tf);
	curl_easy_setopt(mycurl,CURLOPT_WRITEDATA,bf);
	curl_easy_setopt(mycurl,CURLOPT_VERBOSE,1);
	res = curl_easy_perform(mycurl);
	curl_easy_cleanup(mycurl);
	fclose(tf);
	fclose(bf);
	return 0;
}

